﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace Proc_command
{
    class Program
    {
        static void Main(string[] args)
        {
            SqlConnection conSQL = new SqlConnection();
            conSQL. ConnectionString="Data Source=(local);Initial Catalog=sale; User Id=sa; Password=sa";
            conSQL.Open();
            SqlCommand commSql = new SqlCommand();
            commSql.Connection = conSQL;
            commSql.CommandType = CommandType.StoredProcedure;
            commSql.CommandText = "getCustomers";
            SqlParameter paramSQL = new SqlParameter("@id", SqlDbType.Int);
            paramSQL.Direction = ParameterDirection.Input;
            paramSQL.Value = 2;
            commSql.Parameters.Add(paramSQL);
            SqlDataReader datRead = commSql.ExecuteReader();
            do while datRead.Read()
            {
                     Console.WriteLine ("ID: {0} - Name: {1}", dr[0],dr[1]);
            }
            datRead.Close();
        }
    }
}
